/*!
 * Classe d'utilitaires
 * @author Alain Simac-Lejeune
 */
#include "tools.h"

	/*!
	 * Constructor
	 */
	tools::tools(){};

	/*!
	 *
	 * Method for make a resolution string with a x and y values
	 *
	 * @param x : value of width (x)
	 * @param y : value of height (y)
	 * @return  : a QString
	 */
	QString tools::convertResolutionIntegerToQString(int x,int y){
		QString resolution = "";
		std::string s;
		std::ostringstream oss;
		oss<<x;
		oss<<"x";
		oss<<y;
		s =oss.str();
		resolution.sprintf(s.data());
		return resolution;
	}

	/*!
	 *
	 * Method for make a resolution string with a time value
	 *
	 * @param time : value of time
	 * @return     : a QString
	 */
	QString tools::convertTimeMSinString(double time){
		int timems,times,timem;
		timems=(int)(time-floor(time/1000)*1000);
		times=(int)(floor(time/1000));
		timem=(int)(floor(times/60));
		times=times-timem*60;
		QString totalTime = "";
		std::string temp_s;
		std::ostringstream temp_oss;
		temp_oss<<timems;
		temp_oss<<"\"";
		temp_oss<<times;
		temp_oss<<"'";
		temp_oss<<timem;
		temp_s=temp_oss.str();
		totalTime.sprintf(temp_s.data());
		return totalTime;
	}


